﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.EmpbasicService;

namespace CommunitySystem.PageView
{
    public partial class BDGLWindow : ChildWindow
    {
        private Emp_BDGLModel Model { get; set; }
        private EmpBasicServiceClient Client = new EmpBasicServiceClient();
        public BDGLWindow(Emp_BDGLModel entity)
        {
            InitializeComponent();
            Model = entity;
            this.DataContext = Model;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //this.DialogResult = true;
            if (string.IsNullOrEmpty(Model.RMLY))
            {
                SilverlightMessageBoxLibrary.Message.ErrorMessage("任免理由不能为空！");
                return;
            }
            Client.SYQMKH_SBCompleted += new EventHandler<SYQMKH_SBCompletedEventArgs>(Client_SYQMKH_SBCompleted);
            Client.SYQMKH_SBAsync(Model);
        }

        void Client_SYQMKH_SBCompleted(object sender, SYQMKH_SBCompletedEventArgs e)
        {
            if (e.Result)
                SilverlightMessageBoxLibrary.Message.InfoMessage("编辑成功！");
            else
                SilverlightMessageBoxLibrary.Message.InfoMessage("编辑失败！");

            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

